package com.zd.commodity.productMng.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.zd.commodity.action.BaseAction;
import com.zd.commodity.productMng.biz.IProductPriceBiz;
import com.zd.commodity.productMng.entity.ProductPrice;
import com.zd.commodity.userMng.entity.User;

@Scope("prototype")
@Controller("productPriceAction")
public class ProductPriceAction extends BaseAction<ProductPrice> {

	private IProductPriceBiz productPriceBiz;

	public IProductPriceBiz getProductPriceBiz() {
		return productPriceBiz;
	}

	@Autowired
	public void setProductPriceBiz(IProductPriceBiz productPriceBiz) {
		this.productPriceBiz = productPriceBiz;
	    this.setBaseBiz(productPriceBiz);
	}
	
	
	private List<ProductPrice> productPriceList;
	public List<ProductPrice> getProductPriceList() {
		return productPriceList;
	}
	public void setProductPriceList(List<ProductPrice> productPriceList) {
		this.productPriceList = productPriceList;
	}
	
	public void updateProductPrice(){
		ProductPrice t1=super.getT1();
		User user = (User) super.request.getSession().getAttribute("user");
		try {
			productPriceBiz.updateProductPrice(t1,productPriceList,user);
			write(ajaxReturn(true,"修改成功！",null));
		} catch (Exception e) {
			write(ajaxReturn(false,"修改失败！",null));
			e.printStackTrace();
		}
	}
	
}
